package top.frsf.pattern.b_structural.a_adapter;

import top.frsf.pattern.b_structural.a_adapter.driver.MySQLDriver;
import top.frsf.pattern.b_structural.a_adapter.driver.OracleDriver;
import top.frsf.pattern.b_structural.a_adapter.target.MySQLAdapter;
import top.frsf.pattern.b_structural.a_adapter.target.OracleAdapter;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * 目标接口、源对象、适配器对象
 *
 * @author FRSF
 * @since 2024/10/16 21:48
 */
public class Main {
    public static void main(String[] args) throws SQLException {
        MySQLDriver mysqlDriver = new MySQLDriver();
        OracleDriver oracleDriver = new OracleDriver();

        DBConnection mysqlAdapter = new MySQLAdapter(mysqlDriver);
        DBConnection oracleAdapter = new OracleAdapter(oracleDriver);

        // Mysql获取连接
        Connection connection = mysqlAdapter.getConnection();
        // Oracle获取连接
        Connection connection2 = oracleAdapter.getConnection();

    }
}
